def __testBinary(binary_string, length):
    if binary_string == "":
        raise ValueError("must not be empty")
    for i in binary_string:
        if i not in "01":
            raise ValueError("is not a binary string")
    if length is not None and len(binary_string) != length:
        raise ValueError("must be %d bits long" % length)
    return binary_string
        
def __testAlpha(alpha_string, length):
    if alpha_string == "":
        raise ValueError("must not be empty")
    if not alpha_string.isalpha():
        raise ValueError("is not an alpha string")
    if length is not None and len(alpha_string) != length:
        raise ValueError("must be %d letters long" % length)
    return alpha_string

testValues = {
              'binary': __testBinary,
              'alpha': __testAlpha
              }